package com.aaa.phone.service.serviceservice.impl;

import com.aaa.phone.dao.servicedao.ServiceDao;
import com.aaa.phone.service.serviceservice.ServiceService;
import com.aaa.phone.systemconst.ISystemConst;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;
/**
* @description: 手机客服业务实现层
* @author: 王林林
* @create: 2018/12/28 10:05
**/
@Service
public class ServiceServiceImpl implements ServiceService {

    @Autowired
    private ServiceDao dao;

    /*xml文件根据type的值来判断是投诉还是建议并依此向数据库添加信息*/
    @Override
    public int addComplain(String telephone, String complaintDesc,String s,int type) {
        Map<String, Object> map = new HashMap<>();
        map.put("telephone",telephone);
        map.put("complaintDesc",complaintDesc);
        map.put("complaintTypeid",type);
        map.put("imgurl",s);
        int i = dao.addComplain(map);
        //根据添加成功与否返回相应的状态码
        if (i> ISystemConst.ZERO){
            return ISystemConst.PHONE_SUCCESS_CODE;
        }else {
            return ISystemConst.PHONE_DEFEAT_CODE;
        }
    }
}
